package com.code.day14;

import java.time.Duration;
import java.time.LocalDateTime;

public class Day14Duration {
    public static void main(String[] args) {
        LocalDateTime localDateTime1 = LocalDateTime.of(2020, 1, 1, 0, 0);
        LocalDateTime localDateTime2 = LocalDateTime.of(2022, 1, 1, 1, 1);
        Duration duration = Duration.between(localDateTime1, localDateTime2);
        System.out.println(duration.toDays()); //相差的天数
        System.out.println(duration.toHours()); //相差的小时
        System.out.println(duration.toMinutes()); //相差的分钟
        System.out.println(duration.toMillis()); //相差的毫秒
    }
}
